All Questions
40 questions
7votes
1answer
341views
Create tweet threads from String in Java
I recently got this question in an exam, this is how I implemented, it is working fine. However, I would like to know if the code can be improved, as I think it for sure needs to be improved. The ...
8votes
3answers
830views
Creating Two-Dimensional String Array for Plane Seats
I'm creating a ticket reservation system in Java, I want to use a Two-dimensional String array for managing the seats. I have enums that hold the plane model and the amount of seats available so the ...
2votes
1answer
2kviews
Add comma/and between string array in java
i get an array of authors from json response and i have to display authors name in TextView(android) in proper format like =>Viraj, Chetan and George R. R. Martin my code work fine, but it's a mess....
3votes
1answer
380views
Random String Chooser
I was tasked with creating the class RandomStringChooser that prints the strings in the passed array in a random order, based on the ...
5votes
2answers
1kviews
Find hamming distance between two Strings of equal length in Java
I have a private class that I want to be able to find the shortest Hamming Distance between two Strings of equal length in Java. The private class holds a char[] ...
6votes
3answers
370views
Leetcode - First Unique Character in a String
Given a string, find the first non-repeating character in it and return its index. If it doesn't exist, return -1. Examples: ...
3votes
2answers
104views
I/O-TxtFile Line Distance Program
I am trying to write a lab/program that loops through a .txt input file. Reads an entire line of data as a string, then splits that string into an array delimited by a space. If there are 4 items in ...
3votes
2answers
3kviews
Swapping pairs of characters in a String
Question: Write a program to swap pairs of characters of a String. In case of odd number of characters last character should remain unchanged. Examples: Input: HI Output: IH ...
3votes
3answers
324views
Search for names in a hard-coded list of contacts
I am currently taking a class at my local community college for java programming as well as trying to learn as much as I can on my own time. I would like your opinion on a program I wrote that would ...
3votes
3answers
34kviews
Print a String's even and odd indexes
I implemented this method and wanted to get suggestions and or improvements. The objective of the method is to print the even and odd indexes of Strings contained within an array. Each set of indexes(...
10votes
4answers
13kviews
Replace ' ' Spaces in a URL with a '%20' - Coding Challenge
This was a small coding challenge proposed at my school. The problem is: Given a string (or URL), replace the white-spaces inside of the string with %20, but ...
5votes
1answer
744views
Sequence Alignment of two Strings
I have some code which aligns the sequence of two strings, I am doing numbers just for my implementation. I was wondering whether there are any performance enhancements I could make as the code ...
1vote
1answer
973views
Method that remove duplicates from a list of words in Java [closed]
Today, I took a coding challenge with this question: Given a List of Strings, write a method removeDuplicates that removes duplicate words from the List and returns an ArrayList of all the unique ...
2votes
0answers
106views
With 2 sets of strings, find a string that can be constructed from either set
Given the following sets of strings: are yo you u how nhoware alan arala dear de I need to find a sequence that can be constructed by concatenating the strings ...
4votes
1answer
132views
Practicing arrays with String class methods
I am a Spanish programming teacher in a vocational training course and we are studying arrays. In order to practice and to get the students familiarized with some methods of the ...